package com.blockchain.console.servlets.financial.ptzjgl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.financial.PtzjManage;
import com.blockchain.console.service.trading.TradingManage;
import com.blockchain.console.service.trading.entity.XlbEntity;
import com.blockchain.console.servlets.financial.AbstractFinancialServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_FINANCE_PTQBADD", name = "平台虚拟币钱包账户-添加")
public class AddPtqb extends AbstractFinancialServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		TradingManage tsradingManage = serviceSession.getService(TradingManage.class);
		XlbEntity [] xlb=tsradingManage.getXlbxx();
		request.setAttribute("xlb", xlb);
		forwardView(request, response, getClass());
	}

	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		int bid=IntegerParser.parse(request.getParameter("bid"));
		String dz=request.getParameter("dz");
		String sy=request.getParameter("sy");
		String wallet_ip=request.getParameter("wallet_ip");
		String wallet_port=request.getParameter("wallet_port");
		String wallet_username=request.getParameter("wallet_username");
		String wallet_password=request.getParameter("wallet_password");
		PtzjManage ptzjManage = serviceSession.getService(PtzjManage.class);
		ptzjManage.addQb(bid, dz, sy,wallet_ip,wallet_port,wallet_username,wallet_password);
		sendRedirect(request, response, getController().getURI(request, PtqbList.class));
	}
}
